class WordsLabelRenderer extends eui.ItemRenderer {
    private labelDisplay:eui.Label;
    private MeaningLabel:eui.Label;
    private dataGroup:eui.Group;
    private toggleBtn:eui.ToggleButton;
    private bcImg:eui.Image;
    public constructor(){
        super();
        this.touchChildren = true;
        this.bcImg=new eui.Image();
        this.MeaningLabel=new eui.Label();
        this.bcImg.source="resource/assets/ErrorBook/单元格1.png";
        this.bcImg.x=4;
        this.labelDisplay = new eui.Label(); 
        this.toggleBtn=new eui.ToggleButton();//新加
        this.toggleBtn.x=667;
        this.toggleBtn.y=20;
        this.toggleBtn.skinName="resource/skins/scene/toggleBtn.exml";
        this.dataGroup=new eui.Group();// 新加
        this.dataGroup.addChild(this.bcImg);     
        this.dataGroup.addChild(this.labelDisplay);
        this.dataGroup.addChild(this.MeaningLabel);
        this.dataGroup.addChild(this.toggleBtn);
        this.toggleBtn.addEventListener(egret.Event.CHANGE,this.onClick,this);
        this.addChild(this.dataGroup);
    }
    protected dataChanged():void{
        //显示数据中的 label 值
        this.MeaningLabel.visible=false;
        this.dataGroup.width=750;
        this.dataGroup.height=90;
        this.MeaningLabel.width=448;
        this.MeaningLabel.height=82;
        this.MeaningLabel.x=210;
        this.MeaningLabel.y=0;
        this.MeaningLabel.verticalAlign="middle";
        this.MeaningLabel.size=24;
        this.MeaningLabel.textColor=0x999999;
        this.MeaningLabel.text=this.data.meaning;
        this.labelDisplay.width=180;
        this.labelDisplay.height=82;
        this.labelDisplay.left=30;
        this.labelDisplay.textAlign="left";
        this.labelDisplay.verticalAlign="middle";
        this.labelDisplay.textColor=0x333333;
        this.labelDisplay.size=28;
        this.labelDisplay.text=this.data.label;        
    }
    private onClick():void{
        if(this.toggleBtn.selected){
            this.MeaningLabel.visible=true;
        }
        else{
            this.MeaningLabel.visible=false;
        }
    }
}